package com.cg.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PatternUtil {
    //验证邮箱格式
    public static Boolean isEmail(String email){
        //正则表达式
        String pattern = "\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}";
        //匹配对象
        Pattern r = Pattern.compile(pattern);
        //被验证字符串
        Matcher m = r.matcher(email);
        //返回
        return m.matches();
    }
}
